from duetopia.opensearch.client import Description, Request
import sys

url = None
if len(sys.argv) > 1:
    url = sys.argv[1]
else:
    url = "http://127.0.0.1:8000/duetopia/register/dataset/description/"

d = Description(url)

print "Response types available:"
#for t in d.types(): print t
print d.types()

r = d.request("application/json")

print r.info('geometry')

#r['geometry'] = "-90, -180, 0, -180, 90, -180, 90, 180, 0, 180, -90, 180, -90, -180"

#r['geometry'] = "45.256,-110.45,46.46,-109.48,43.84,-109.86,45.256,-110.45"
r['title'] = 'bridge'
print r
print r.response()

# http://www.opensearch.org/Specifications/OpenSearch/Extensions/Geo/1.0/Draft_1#The_.22polygon.22_parameter
